﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using MayhemWpf.UserControls;

namespace ComputerMayhem.Wpf
{
    /// <summary>
    /// Interaction logic for BatteryConfig.xaml
    /// </summary>
    public partial class PowerSourceConfig : WpfConfiguration
    {

        public override string Title
        {
            get
            {
                return "Power Source";
            }
        }

        public Microsoft.WindowsAPICodePack.ApplicationServices.PowerSource PowerSource
        {
            get;
            set; 
        }


        public PowerSourceConfig(Microsoft.WindowsAPICodePack.ApplicationServices.PowerSource powerSource)
        {
            InitializeComponent();
            PowerSource = powerSource;

            PowerSourcesComboBox.Items.Add(Microsoft.WindowsAPICodePack.ApplicationServices.PowerSource.AC);
            PowerSourcesComboBox.Items.Add(Microsoft.WindowsAPICodePack.ApplicationServices.PowerSource.Battery);
            PowerSourcesComboBox.Items.Add(Microsoft.WindowsAPICodePack.ApplicationServices.PowerSource.Ups);

            PowerSourcesComboBox.SelectedIndex = PowerSourcesComboBox.Items.IndexOf(PowerSource);

            CanSave = true;
        }

        public override void OnLoad()
        {
            PowerSourcesComboBox.SelectedIndex = PowerSourcesComboBox.Items.IndexOf(PowerSource);
        }

        public override void OnSave()
        {
            PowerSource = (Microsoft.WindowsAPICodePack.ApplicationServices.PowerSource)PowerSourcesComboBox.SelectedValue;

        }

    }
}
